]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dashSpacer: Don't trigger allocations from size negotiations
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 30 Apr 2019 11:31:51 +0000 (13:31 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 30 Apr 2019 20:59:28 +0000 (20:59 +0000)
If an actor's allocation is outdated, clutter_actor_get_allocation_box()
will queue a relayout. That's why it's advised to not use the function
unless the allocation is known to be valid (namely during paint), but
in particular not from within get_preferred_width/height vfuncs.

Using the :allocation property (which may be outdated) would be better,
but in this case we can simply delegate the request to the correct actor.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1065

js/ui/overviewControls.js

index 5b95b749d4ba87265957c2a5631c1654ad067b6b..930bbb2209b6aced5ef554f408bfc1db9ba76cdf 100644 (file)
@@ -369,17 +369,15 @@ class DashSpacer extends St.Widget {
     }
 
     vfunc_get_preferred_width(forHeight) {
-        let box = this.get_allocation_box();
-        let minWidth = super.vfunc_get_preferred_width(forHeight)[0];
-        let natWidth = box.x2 - box.x1;
-        return [minWidth, natWidth];
+        if (this._bindConstraint)
+            return this._bindConstraint.source.get_preferred_width(forHeight);
+        return super.vfunc_get_preferred_width(forHeight);
     }
 
     vfunc_get_preferred_height(forWidth) {
-        let box = this.get_allocation_box();
-        let minHeight = super.vfunc_get_preferred_height(forWidth)[0];
-        let natHeight = box.y2 - box.y1;
-        return [minHeight, natHeight];
+        if (this._bindConstraint)
+            return this._bindConstraint.source.get_preferred_height(forWidth);
+        return super.vfunc_get_preferred_height(forWidth);
     }
 });